package com.map.lbs;

import com.baidu.mapapi.GeoPoint;

public class MapViewScope {
    private int top;
    private int bottom;
    private int left;
    private int right;
    
    public MapViewScope(int latitudeE6Span, int longitudeE6Span, GeoPoint center){
    	top = center.getLatitudeE6() - latitudeE6Span / 2;
    	bottom = center.getLatitudeE6() + latitudeE6Span / 2;
    	left = center.getLongitudeE6() - longitudeE6Span / 2;
    	right = center.getLongitudeE6() + longitudeE6Span / 2;
    }
    
	public MapViewScope(int top, int bottom, int left, int right) {
		super();
		this.top = top;
		this.bottom = bottom;
		this.left = left;
		this.right = right;
	}
	
	public int getTop() {
		return top;
	}
	public void setTop(int top) {
		this.top = top;
	}
	public int getBottom() {
		return bottom;
	}
	public void setBottom(int bottom) {
		this.bottom = bottom;
	}
	public int getLeft() {
		return left;
	}
	public void setLeft(int left) {
		this.left = left;
	}
	public int getRight() {
		return right;
	}
	public void setRight(int right) {
		this.right = right;
	}

	public boolean equals(MapViewScope other){
		if(top == other.top && bottom == other.bottom
				&& left == other.left && right == other.right){
			return true;
		}
		
		return false;
	}
	
	@Override
	public String toString(){
		StringBuffer buffer = new StringBuffer();
		buffer.append("top: ").append(top).append(";");
		buffer.append("right: ").append(right).append(";");
		buffer.append("bottom: ").append(bottom).append(";");
		buffer.append("left: ").append(left).append(";");
		
		return buffer.toString();
	}
}
